package com.zf.spring.microservice.zuul.common.token.jwt;

import io.jsonwebtoken.SignatureAlgorithm;

import javax.crypto.spec.SecretKeySpec;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties("gateway.token.jwt")
public class JwtConfiguration {
	private String key;

	/**
	 * @return the key
	 */
	private String getKey() {
		return key;
	}

	/**
	 * @param key the key to set
	 */
	public void setKey(String key) {
		this.key = key;
	}
	
	public SecretKeySpec getSecretKeySpec(){
		SecretKeySpec secretKeySpec = new SecretKeySpec(this.getKey().getBytes(), SignatureAlgorithm.HS512.getJcaName());
		return secretKeySpec;
	}
	
}
